import AppConstants from "../AppConstants"
import PanelMgr from "./PanelMgr"
import ViewBase from "./ViewBase"


/**
 * @description 面板基类
 * @author mirahs
 * @email 2892727493@qq.com
 */
export default class PanelBase extends ViewBase {
    public panelName: string
    public panelShowStyle: number = AppConstants.panelShowStyle.Normal
    public panelMaskStyle: number = AppConstants.panelMaskStyle.NoThrough
    public duration: number = 0.2 //有位移或缩放面板过渡时间
    public blackMaskDuration: number = 0.1 //半透明遮罩从透明到半透明的过渡时间
    public blackMaskOpacity: number = 125 //半透明遮罩透明度
    public easingShow: any //打开时的缓动效果
    public easingHide: any //关闭时的缓动效果
    public tweenShow: cc.Tween //自定义打开动画
    public tweenHide: cc.Tween //自定义关闭动画


    // 关闭面板(有动画)
    public close() {
        PanelMgr.hide(this.panelName)
    }

    // 关闭面板(无动画, 立即关闭)
    public closeImmediate() {
        PanelMgr.destroy(this.panelName)
    }
}
